﻿using PoemGame.Management.Domain;

namespace PoemGame.Management.Repository
{
    public class GameRepository:IGameRepository
    {
        private readonly ManagementDbContext dbContext;
        public GameRepository(ManagementDbContext dbContext)
        {
            this.dbContext = dbContext;
        }
        public async Task Add(Game game)
        {
            await dbContext.Games.AddAsync(game);
            await dbContext.SaveChangesAsync();
        }

        public async Task Update(Game game)
        {
            dbContext.Games.Update(game);
            await dbContext.SaveChangesAsync();
        }

        public async Task Delete(Game game)
        {
            dbContext.Games.Remove(game);
            await dbContext.SaveChangesAsync();
        }
    }
}